import {createRouter, createWebHistory} from "vue-router";

export default createRouter({
    history: createWebHistory(),
    routes: [
        // 主页
        {
            path: '/home',
            component: () => import('@/pages/home/index.vue'),
            meta: {
                title: '首页'
            }
        },
        // 医院页面
        {
            path: '/hospital',
            component: () => import('@/pages/hospital/index.vue'),
            meta: {
                title: '医院'
            },
            children: [
                // 预约挂号
                {
                    path: 'register',
                    component: () => import('@/pages/hospital/register/index.vue'),
                    meta: {
                        title: '挂号'
                    }
                },

                // 正式挂号1
                {
                    path: 'register_step1',
                    component: () => import('@/pages/hospital/register/register_step1.vue'),
                    meta: {
                        title: '挂号-1'
                    }
                },
                // 正式挂号2
                {
                    path: 'register_step2',
                    component: () => import('@/pages/hospital/register/register_step2.vue'),
                    meta: {
                        title: '挂号-2'
                    }
                },
                // 停诊信息
                {
                    path: 'message',
                    component: () => import('@/pages/hospital/message/index.vue'),
                    meta: {
                        title: '停诊信息'
                    }
                },
                // 预约须知
                {
                    path: 'notice',
                    component: () => import('@/pages/hospital/notice/index.vue'),
                    meta: {
                        title: '预约须知'
                    }
                },
                // 医院详情
                {
                    path: 'detail',
                    component: () => import('@/pages/hospital/detail/index.vue'),
                    meta: {
                        title: '医院详情'
                    }
                },
                // 查询/取消
                {
                    path: 'search',
                    component: () => import('@/pages/hospital/search/index.vue'),
                    meta: {
                        title: '查询/取消'
                    }
                }


            ]
        },

        // 用户页面
        {
            path: '/user',
            component: () => import('@/pages/user/index.vue'),
            meta: {
                title: '用户页面'
            },
            children: [
                // 实名认证
                {
                    path: 'authentication',
                    component: () => import('@/pages/user/authentication/index.vue'),
                    meta:{
                        title:'实名认证'
                    }
                },
                // 意见反馈
                {
                    path: 'feedback',
                    component: () => import('@/pages/user/feedback/index.vue'),
                    meta:{
                        title:'意见反馈'
                    }
                },
                // 就诊人管理
                {
                    path: 'manage',
                    component: () => import('@/pages/user/manage/index.vue'),
                    meta:{
                        title:'就诊人管理'
                    }
                },
                // 修改用户信息
                {
                    path: 'modify',
                    component: () => import('@/pages/user/modify/index.vue'),
                    meta:{
                        title:'修改用户信息'
                    }
                },
                // 挂号订单
                {
                    path: 'orders',
                    component: () => import('@/pages/user/orders/index.vue'),
                    meta:{
                        title:'订单'
                    }
                },
            ]
        },
        {
            path: '/',
            redirect: '/home'
        }

    ],
    // 路由跳转后控制滚动条
    scrollBehavior() {
        return {
            lef: 0,
            top: 0
        }
    }

})